<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:insert="common/person-pc/header::personHeadBar('收藏','/static/css/person/paper.css')">
<body class="centre" style="">
<!-- 头部 -->
<!-- 头部信息 -->
<div th:insert="common/person-pc/top::personTopBar(${resCategoryModel})"/>
<!-- END -->
<div class="ey-body-bg">
  <div class="ey-body">
    <div class="ey-container w1200">
      <!-- 侧边 -->
      <div th:insert="common/person-pc/right::rightBar(${show})"/>
      <!-- END -->
      <!-- 中部 -->
      <div class="ey-con fr">
        <div class="el-main main-bg">
          <!-- 顶部导航栏 -->
          <div class="column-title mb20">
            <div class="column-name">系统消息</div>
          </div>
          <!-- END -->
          <div class="el-table el-table--fit el-table--enable-row-hover el-table--enable-row-transition mt20"
               style="width: 100%;">
            <table>
              <thead>
              <tr>
                <th style="width:400px ;">
                  <div class="cell">标题</div>
                </th>
                <th style="width: 100px;">
                  <div class="cell tc">发件人</div>
                </th>
                <th style="width: 120px;">
                  <div class="cell tc">状态</div>
                </th>
                <th style="width: 204px;">
                  <div class="cell tc">发送时间</div>
                </th>
              </tr>
              </thead>
              <tbody>
              <th:block th:each="messageData:${list}">
                <tr>
                  <td>
                    <div class="cell  seecontent" th:text="${messageData.title}" style="cursor: pointer" th:data-msgid="${messageData.messageId}" onclick="seeMessageDetail(this)"></div>
                  </td>
                  <td>
                    <div class="cell tc">资源基地</div>
                  </td>
                  <td>
                    <div class="cell tc" th:text="${messageData.status}"></div>
                  </td>
                  <td>
                    <div class="cell tc" th:text="${#dates.format(messageData?.createTime, 'yyyy-MM-dd HH:mm:ss')}"></div>
                  </td>
                </tr>
              </th:block>
              </tbody>
            </table>
          </div>
          <script th:inline="javascript">
            var count = [[${total}]];
            var currentPage = [[${currentPage}]];
            var requestUrl = [[${requestUrl}]];
          </script>
          <script type="text/javascript" th:src="@{'/static/Kz.layedit/Content/Layui-KnifeZ/layui.js'}"></script>
          <script>
            layui.use('laypage', function () {
              var laypage = layui.laypage;
              //执行一个laypage实例
              laypage.render({
                elem: 'pageId',
                count: count,
                curr: currentPage,  //当前页数
                limit: 10,
                theme: '#1E9FFF',
                jump: function (obj, first) {
                  if (!first) {
                    location.href = requestUrl+"?pageNum=" + obj.curr;
                  }
                }
              });
            });
          </script>
          <div style="text-align: center;" >
            <div id="pageId">
            </div>
            <div class="fytotal">共<span th:text="${total}"></span>条记录</div>
          </div>
        </div>
        <!-- END -->
      </div>

    </div>
  </div>
</div>
<!-- 底部 -->
<div class="ey-footer">
  <footer class="container">
    <p>Copyright © 2012-2018 资源基地 版权所有</p>
  </footer>
</div>
<script>

  $(".seecontent").mouseover(function() {
    layer.tips('查看邮件', this, {
      tips: [1, "#000"]
    });
  });

  function seeMessageDetail(obj){
    $.ajax({
      type: "POST",
      url: "/user/findMessageByNotifyId",
      data: {"id": $(obj).attr('data-msgid'),"type":3},
      success: function (res) {
        if (res.rt == -1) {
          showErrorMsg("未登录请先登录!");
        }else {
          var index =layer.open({
            type: 0,
            title: ['邮件内容', 'font-size:18px; color:red;'],
            area: '500px',
            content: res.rt.content,
            yes: function(index, layero){
              layer.close(index);
              window.location.reload();
            }
          });
        }
      },
      error: function (e) {
        layer.closeAll();
        showErrorAlert("网络异常,请稍后再试!");
      }
    });
  }

</script>
</body>
</html>
